package com.kk.xhr.model.service.impl;

import com.kk.xhr.model.dao.PoliticMapper;
import com.kk.xhr.model.entity.Politic;
import com.kk.xhr.model.service.IPoliticService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 政治地位服务接口实现
 *
 * @author kkmystery
 * @version 1.0 2021/3/4
 * @since 1.0.0
 */
@Repository
@RequiredArgsConstructor
public class PoliticServiceImpl implements IPoliticService {
    private final PoliticMapper politicMapper;

    @Override
    public List<Politic> query() {
        return politicMapper.select(dsl -> dsl);
    }

    @Override
    public String queryById(Long id) {
        return politicMapper.selectByPrimaryKey(id).map(Politic::getName).get();
    }
}
